package com.yanti.util;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.springframework.ai.chat.messages.AssistantMessage;
import org.springframework.ai.chat.messages.SystemMessage;
import org.springframework.ai.chat.messages.UserMessage;

@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "messageType")
@JsonSubTypes({
    @JsonSubTypes.Type(value = UserMessage.class, name = "USER"),
    @JsonSubTypes.Type(value = AssistantMessage.class, name = "ASSISTANT"),
    @JsonSubTypes.Type(value = SystemMessage.class, name = "SYSTEM")
})
public abstract class MessageMixIn {
    @JsonCreator
    public MessageMixIn(@JsonProperty("content") String content) {}
}